package com.example.myapplication;



        import android.annotation.TargetApi;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
        import android.content.pm.ChangedPackages;
        import android.content.pm.FeatureInfo;
import android.content.pm.InstrumentationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.content.pm.PermissionGroupInfo;
import android.content.pm.PermissionInfo;
import android.content.pm.ProviderInfo;
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
        import android.content.pm.SharedLibraryInfo;
        import android.content.pm.VersionedPackage;
        import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;

import java.lang.reflect.Method;
import java.util.List;

public class PackageManagerProxy extends PackageManager {
    static final String TAG = "AdmobTest";
    private final Context mContext;
    private final PackageManager mPackageManager;
    private String mPackageName;

    public PackageManagerProxy(PackageManager arg1, String arg2, Context arg3) {
        super();
        this.mPackageManager = arg1;
        this.mPackageName = arg2;
        this.mContext = arg3;
    }

    public void addPackageToPreferred(String arg2) {
        this.mPackageManager.addPackageToPreferred(arg2);
    }

    public boolean addPermission(PermissionInfo arg2) {
        return this.mPackageManager.addPermission(arg2);
    }

    @TargetApi(value=8) public boolean addPermissionAsync(PermissionInfo arg2) {
        return this.mPackageManager.addPermissionAsync(arg2);
    }

    public void addPreferredActivity(IntentFilter arg2, int arg3, ComponentName[] arg4, ComponentName arg5) {
        this.mPackageManager.addPreferredActivity(arg2, arg3, arg4, arg5);
    }

    @TargetApi(value=8) public String[] canonicalToCurrentPackageNames(String[] arg2) {
        return this.mPackageManager.canonicalToCurrentPackageNames(arg2);
    }

    public int checkPermission(String arg2, String arg3) {
        if(this.mPackageName.equals(arg3)) {
            arg3 = this.mContext.getPackageName();
        }

        return this.mPackageManager.checkPermission(arg2, arg3);
    }

    public int checkSignatures(int arg2, int arg3) {
        return this.mPackageManager.checkSignatures(arg2, arg3);
    }

    public int checkSignatures(String arg2, String arg3) {
        return this.mPackageManager.checkSignatures(arg2, arg3);
    }

    public void clearPackagePreferredActivities(String arg2) {
        this.mPackageManager.clearPackagePreferredActivities(arg2);
    }

    @TargetApi(value=8) public String[] currentToCanonicalPackageNames(String[] arg2) {
        return this.mPackageManager.currentToCanonicalPackageNames(arg2);
    }

    @TargetApi(value=17) public void extendVerificationTimeout(int arg2, int arg3, long arg4) {
        this.mPackageManager.extendVerificationTimeout(arg2, arg3, arg4);
    }

    @TargetApi(value=20) public Drawable getActivityBanner(ComponentName arg2) throws NameNotFoundException {
        return this.mPackageManager.getActivityBanner(arg2);
    }

    @TargetApi(value=20) public Drawable getActivityBanner(Intent arg2) throws NameNotFoundException {
        return this.mPackageManager.getActivityBanner(arg2);
    }

    public Drawable getActivityIcon(ComponentName arg2) throws NameNotFoundException {
        return this.mPackageManager.getActivityIcon(arg2);
    }

    public Drawable getActivityIcon(Intent arg2) throws NameNotFoundException {
        return this.mPackageManager.getActivityIcon(arg2);
    }

    public ActivityInfo getActivityInfo(ComponentName arg4, int arg5) throws NameNotFoundException {
        if(arg4 != null && (this.mPackageName.equals(arg4.getPackageName()))) {
            Log.e("AdmobTest", "getActivityInfo");
            arg4 = new ComponentName(this.mContext.getPackageName(), arg4.getClassName());
        }

        return this.mPackageManager.getActivityInfo(arg4, arg5);
    }

    @TargetApi(value=9) public Drawable getActivityLogo(ComponentName arg2) throws NameNotFoundException {
        return this.mPackageManager.getActivityLogo(arg2);
    }

    @TargetApi(value=9) public Drawable getActivityLogo(Intent arg2) throws NameNotFoundException {
        return this.mPackageManager.getActivityLogo(arg2);
    }

    public List getAllPermissionGroups(int arg2) {
        return this.mPackageManager.getAllPermissionGroups(arg2);
    }

    @TargetApi(value=20) public Drawable getApplicationBanner(ApplicationInfo arg2) {
        return this.mPackageManager.getApplicationBanner(arg2);
    }

    @TargetApi(value=20) public Drawable getApplicationBanner(String arg2) throws NameNotFoundException {
        return this.mPackageManager.getApplicationBanner(arg2);
    }

    public int getApplicationEnabledSetting(String arg2) {
        return this.mPackageManager.getApplicationEnabledSetting(arg2);
    }

    public Drawable getApplicationIcon(ApplicationInfo arg2) {
        return this.mPackageManager.getApplicationIcon(arg2);
    }

    public Drawable getApplicationIcon(String arg2) throws NameNotFoundException {
        return this.mPackageManager.getApplicationIcon(arg2);
    }

    public ApplicationInfo getApplicationInfo(String arg3, int arg4) throws NameNotFoundException {
        ApplicationInfo v0;
        if((TextUtils.isEmpty(this.mPackageName)) || !arg3.equals(this.mPackageName)) {
            v0 = this.mPackageManager.getApplicationInfo(arg3, arg4);
        }
        else {
            v0 = this.mPackageManager.getApplicationInfo(this.mContext.getPackageName(), arg4);
            v0.packageName = this.mPackageName;
        }

        return v0;
    }

    public CharSequence getApplicationLabel(ApplicationInfo arg2) {
        return this.mPackageManager.getApplicationLabel(arg2);
    }

    @TargetApi(value=9) public Drawable getApplicationLogo(ApplicationInfo arg2) {
        return this.mPackageManager.getApplicationLogo(arg2);
    }

    @TargetApi(value=9) public Drawable getApplicationLogo(String arg2) throws NameNotFoundException {
        return this.mPackageManager.getApplicationLogo(arg2);
    }

    public int getComponentEnabledSetting(ComponentName arg2) {
        return this.mPackageManager.getComponentEnabledSetting(arg2);
    }

    public Drawable getDefaultActivityIcon() {
        return this.mPackageManager.getDefaultActivityIcon();
    }

    public Drawable getDrawable(String arg2, int arg3, ApplicationInfo arg4) {
        return this.mPackageManager.getDrawable(arg2, arg3, arg4);
    }

    public List getInstalledApplications(int arg2) {
        return this.mPackageManager.getInstalledApplications(arg2);
    }

    @Override
    public boolean isInstantApp() {
        return false;
    }

    @Override
    public boolean isInstantApp(String s) {
        return false;
    }

    @Override
    public int getInstantAppCookieMaxBytes() {
        return 0;
    }

    @Override
    public byte[] getInstantAppCookie() {
        return new byte[0];
    }

    @Override
    public void clearInstantAppCookie() {

    }

    @Override
    public void updateInstantAppCookie(byte[] bytes) {

    }

    public List getInstalledPackages(int arg2) {
        return this.mPackageManager.getInstalledPackages(arg2);
    }

    public String getInstallerPackageName(String arg2) {
        return "com.android.vending";
    }

    public InstrumentationInfo getInstrumentationInfo(ComponentName arg2, int arg3) throws NameNotFoundException {
        return this.mPackageManager.getInstrumentationInfo(arg2, arg3);
    }

    public Intent getLaunchIntentForPackage(String arg2) {
        return this.mPackageManager.getLaunchIntentForPackage(arg2);
    }

    @TargetApi(value=21) public Intent getLeanbackLaunchIntentForPackage(String arg2) {
        return this.mPackageManager.getLeanbackLaunchIntentForPackage(arg2);
    }

    public String getNameForUid(int arg2) {
        return this.mPackageManager.getNameForUid(arg2);
    }

    public int[] getPackageGids(String arg2) throws NameNotFoundException {
        return this.mPackageManager.getPackageGids(arg2);
    }

    @TargetApi(value=24) public int[] getPackageGids(String arg2, int arg3) throws NameNotFoundException {
        return this.mPackageManager.getPackageGids(arg2, arg3);
    }

    public PackageInfo getPackageInfo(String arg3, int arg4) throws NameNotFoundException {
        PackageInfo v0;
        if((TextUtils.isEmpty(this.mPackageName)) || !arg3.equals(this.mPackageName)) {
            v0 = this.mPackageManager.getPackageInfo(arg3, arg4);
        }
        else {
            v0 = this.mPackageManager.getPackageInfo(this.mContext.getPackageName(), arg4);
            v0.packageName = this.mPackageName;
        }

        return v0;
    }

    @Override
    public PackageInfo getPackageInfo(VersionedPackage versionedPackage, int i) throws NameNotFoundException {
        return null;
    }

    @TargetApi(value=21) public PackageInstaller getPackageInstaller() {
        return this.mPackageManager.getPackageInstaller();
    }

    @Override
    public boolean canRequestPackageInstalls() {
        return false;
    }

    @TargetApi(value=24) public int getPackageUid(String arg2, int arg3) throws NameNotFoundException {
        return this.mPackageManager.getPackageUid(arg2, arg3);
    }

    public String[] getPackagesForUid(int arg2) {
        return this.mPackageManager.getPackagesForUid(arg2);
    }

    @TargetApi(value=18) public List getPackagesHoldingPermissions(String[] arg2, int arg3) {
        return this.mPackageManager.getPackagesHoldingPermissions(arg2, arg3);
    }

    public PermissionGroupInfo getPermissionGroupInfo(String arg2, int arg3) throws NameNotFoundException {
        return this.mPackageManager.getPermissionGroupInfo(arg2, arg3);
    }

    public PermissionInfo getPermissionInfo(String arg2, int arg3) throws NameNotFoundException {
        return this.mPackageManager.getPermissionInfo(arg2, arg3);
    }

    public int getPreferredActivities(List arg2, List arg3, String arg4) {
        return this.mPackageManager.getPreferredActivities(arg2, arg3, arg4);
    }

    public List getPreferredPackages(int arg2) {
        return this.mPackageManager.getPreferredPackages(arg2);
    }

    @TargetApi(value=9) public ProviderInfo getProviderInfo(ComponentName arg2, int arg3) throws NameNotFoundException {
        return this.mPackageManager.getProviderInfo(arg2, arg3);
    }

    public ActivityInfo getReceiverInfo(ComponentName arg2, int arg3) throws NameNotFoundException {
        return this.mPackageManager.getReceiverInfo(arg2, arg3);
    }

    public Resources getResourcesForActivity(ComponentName arg2) throws NameNotFoundException {
        return this.mPackageManager.getResourcesForActivity(arg2);
    }

    public Resources getResourcesForApplication(ApplicationInfo arg2) throws NameNotFoundException {
        return this.mPackageManager.getResourcesForApplication(arg2);
    }

    public Resources getResourcesForApplication(String arg2) throws NameNotFoundException {
        return this.mPackageManager.getResourcesForApplication(arg2);
    }

    public ServiceInfo getServiceInfo(ComponentName arg2, int arg3) throws NameNotFoundException {
        return this.mPackageManager.getServiceInfo(arg2, arg3);
    }

    public FeatureInfo[] getSystemAvailableFeatures() {
        return this.mPackageManager.getSystemAvailableFeatures();
    }

    public int getSystemFeatureLevel() {
        if(this.mPackageManager != null) {
            Class v0 = this.mPackageManager.getClass();
            try {
                Method v2 = v0.getDeclaredMethod("getSystemFeatureLevel");
                v2.setAccessible(true);
                int v0_2 = ((Number)v2.invoke(v0)).intValue();
                return v0_2;
            }
            catch(Exception v0_1) {
                v0_1.printStackTrace();
            }
        }

        return 1;
    }

    public String[] getSystemSharedLibraryNames() {
        return this.mPackageManager.getSystemSharedLibraryNames();
    }

    @Override
    public List<SharedLibraryInfo> getSharedLibraries(int i) {
        return null;
    }

    @Override
    public ChangedPackages getChangedPackages(int i) {
        return null;
    }

    public CharSequence getText(String arg2, int arg3, ApplicationInfo arg4) {
        return this.mPackageManager.getText(arg2, arg3, arg4);
    }

    @TargetApi(value=21) public Drawable getUserBadgedDrawableForDensity(Drawable arg2, UserHandle arg3, Rect arg4, int arg5) {
        return this.mPackageManager.getUserBadgedDrawableForDensity(arg2, arg3, arg4, arg5);
    }

    @TargetApi(value=21) public Drawable getUserBadgedIcon(Drawable arg2, UserHandle arg3) {
        return this.mPackageManager.getUserBadgedIcon(arg2, arg3);
    }

    @TargetApi(value=21) public CharSequence getUserBadgedLabel(CharSequence arg2, UserHandle arg3) {
        return this.mPackageManager.getUserBadgedLabel(arg2, arg3);
    }

    public XmlResourceParser getXml(String arg2, int arg3, ApplicationInfo arg4) {
        return this.mPackageManager.getXml(arg2, arg3, arg4);
    }

    public boolean hasSystemFeature(String arg2) {
        return this.mPackageManager.hasSystemFeature(arg2);
    }

    @TargetApi(value=24) public boolean hasSystemFeature(String arg2, int arg3) {
        return this.mPackageManager.hasSystemFeature(arg2, arg3);
    }

    @TargetApi(value=23) public boolean isPermissionRevokedByPolicy(String arg2, String arg3) {
        return this.mPackageManager.isPermissionRevokedByPolicy(arg2, arg3);
    }

    public boolean isSafeMode() {
        return this.mPackageManager.isSafeMode();
    }

    @Override
    public void setApplicationCategoryHint(String s, int i) {

    }

    public List queryBroadcastReceivers(Intent arg2, int arg3) {
        return this.mPackageManager.queryBroadcastReceivers(arg2, arg3);
    }

    public List queryContentProviders(String arg2, int arg3, int arg4) {
        return this.mPackageManager.queryContentProviders(arg2, arg3, arg4);
    }

    public List queryInstrumentation(String arg2, int arg3) {
        return this.mPackageManager.queryInstrumentation(arg2, arg3);
    }

    public List queryIntentActivities(Intent arg2, int arg3) {
        return this.mPackageManager.queryIntentActivities(arg2, arg3);
    }

    public List queryIntentActivityOptions(ComponentName arg2, Intent[] arg3, Intent arg4, int arg5) {
        return this.mPackageManager.queryIntentActivityOptions(arg2, arg3, arg4, arg5);
    }

    @TargetApi(value=19) public List queryIntentContentProviders(Intent arg2, int arg3) {
        return this.mPackageManager.queryIntentContentProviders(arg2, arg3);
    }

    public List queryIntentServices(Intent arg2, int arg3) {
        return this.mPackageManager.queryIntentActivities(arg2, arg3);
    }

    public List queryPermissionsByGroup(String arg2, int arg3) throws NameNotFoundException {
        return this.mPackageManager.queryPermissionsByGroup(arg2, arg3);
    }

    public void removePackageFromPreferred(String arg2) {
        this.mPackageManager.removePackageFromPreferred(arg2);
    }

    public void removePermission(String arg2) {
        this.mPackageManager.removePermission(arg2);
    }

    public ResolveInfo resolveActivity(Intent arg4, int arg5) {
        ComponentName v0 = arg4.getComponent();
        if(v0 != null && (this.mPackageName.equals(v0.getPackageName()))) {
            Log.e("AdmobTest", "resolveActivity");
            arg4.setComponent(new ComponentName(this.mContext.getPackageName(), v0.getClassName()));
        }

        return this.mPackageManager.resolveActivity(arg4, arg5);
    }

    public ProviderInfo resolveContentProvider(String arg2, int arg3) {
        return this.mPackageManager.resolveContentProvider(arg2, arg3);
    }

    public ResolveInfo resolveService(Intent arg2, int arg3) {
        return this.mPackageManager.resolveService(arg2, arg3);
    }

    public int semGetSystemFeatureLevel(String arg7) {
        if(this.mPackageManager != null) {
            Class v0 = this.mPackageManager.getClass();
            try {
                Method v2 = v0.getDeclaredMethod("semGetSystemFeatureLevel", String.class);
                v2.setAccessible(true);
                int v0_2 = ((Number)v2.invoke(v0, arg7)).intValue();
                return v0_2;
            }
            catch(Exception v0_1) {
                v0_1.printStackTrace();
            }
        }

        return 1;
    }

    public void setApplicationEnabledSetting(String arg2, int arg3, int arg4) {
        this.mPackageManager.setApplicationEnabledSetting(arg2, arg3, arg4);
    }

    public void setComponentEnabledSetting(ComponentName arg2, int arg3, int arg4) {
        this.mPackageManager.setComponentEnabledSetting(arg2, arg3, arg4);
    }

    @TargetApi(value=11) public void setInstallerPackageName(String arg2, String arg3) {
        this.mPackageManager.setInstallerPackageName(arg2, arg3);
    }

    public void setPackageName(String arg1) {
        this.mPackageName = arg1;
    }

    @TargetApi(value=14) public void verifyPendingInstall(int arg2, int arg3) {
        this.mPackageManager.verifyPendingInstall(arg2, arg3);
    }
}

